<template>
	<view class="dis-history">
		<navBar :title="titleName"></navBar>
		<view class="headLine">
			{{ historyForm.lineSiteSectionName || ''}}
		</view>
		<view class="position-top" v-if="compoType === 'change' || compoType === 'bhsh'">
			<view class="Dlocation">
				<view class="required-form-item">*</view>
				<view class="pos">病害变更</view>
				<u-radio-group v-model="historyForm.diseaseChange" size="22" placement="row" @change="groupChange">
					<u-radio :customStyle="{ marginRight: '50px' }" v-for="(item, index) in radiolist" :key="index"
						:label="item.label" :name="item.value">
					</u-radio>
				</u-radio-group>
			</view>
		</view>
		<view v-else>
			<view class="Dlocation">
				<view class="required-form-item">*</view>
				<view class="">病害变更</view>
			</view>
			<view class="rg1">
				<u-radio-group v-model="radiovalue" size="22" placement="row" @change="groupChange">
					<u-radio :customStyle="{ marginRight: '50px' }" v-for="(item, index) in radiolist1" :key="index"
						:label="item.name" :name="item.name">
					</u-radio>
				</u-radio-group>
			</view>
		</view>
		<view class="content-colot"></view>
		<view class="disease-status">
			<view class="required-form-item">*</view>
			<view class="box-status">
				<text class="txt-star">病害现状</text>
				<view v-show="historyForm.diseaseChange === 'relegation'">
					<u-button size="mini" color="#2f80ed" @click="diseaseJs">常用</u-button>
				</view>
			</view>

		</view>
		<view v-if="historyForm.diseaseChange !== 'selfcure'" style="padding: 0 40rpx;">
			<view class="form-item form-item-description">
				<!-- @blur="inputBlur($event,'status')" -->
				<u-textarea v-model="historyForm.diseaseStatus" placeholder="请输入内容"
					@confirm="getDefineValue($event,'status')" confirmType='done'>
				</u-textarea>
				<record class="form-item-icon form-item-icon-voice" @setText="fnDescription($event,'status')"></record>
				<image v-show="historyForm.diseaseStatus" mode="scaleToFill" class="form-item-icon form-item-icon-clear"
					src="/static/image/login/del1.png" @click="clearTxt($event, 'status')"></image>
			</view>
			<view class="l-dsGrade">
				<view class="l-dsGrade-text">病害等级</view>
				<picker mode="multiSelector" :range="levelColumns" range-key="diseaseGrade" @cancel="fnlevelCancel"
					@columnchange="fnMultiColumnChange" @change="fnMultiPickerChange" :value="values">
					<view class="l-leave" @click="fnChooseLevel" v-show="historyForm.diseaseStatus">
						{{ historyForm.diseaseGrade || '' }}{{ historyForm.diseaseNo  || ''}}
						<u-icon class='icon-disease' name="arrow-right"></u-icon>
					</view>
				</picker>
			</view>
		</view>
		<!-- 自愈 -->
		<view v-else>
			<view class="explanation">{{ historyForm.diseaseStatus }}</view>
			<view class="l-dsGrade">
				<view class="l-dsGrade-text">病害等级</view>
				<view class="l-leave" style="padding-right: 50rpx;">{{ historyForm.diseaseGrade }}</view>
			</view>
		</view>

		<view class="content-colot"></view>
		<view class="photo-list">
			<view class="photo-top">
				<view class="photo-text">病害照片</view>
			</view>
			<u-upload :fileList="fileListImg" @afterRead="afterRead" @delete="deletePic" name="Img" multiple
				:maxCount="9" :previewFullImage="true" accept="image"></u-upload>
		</view>
		<compressionImage></compressionImage>

		<!-- 视频开始 -->
		<view class="content-colot"></view>
		<commonVideoUpload :videoFileList="historyForm.videoFileList" :playVideoSrc="playVideoSrc" @clickMedias="clickMedias"
			@handleClickPreview="handleClickPreview" @closePlayVideoSrc="playVideoSrc = ''" @closeFile="closeFile"></commonVideoUpload>
		<!-- 视频结束 -->

		<view class="content-colot"></view>
		<view class="d-remarks">
			<view class="d-text">
				<view>修复措施</view>
				<view class="">
					<u-button size="mini" color="#2f80ed" @click="chooseRepair">常用</u-button>
				</view>
			</view>
			<view class="form-item form-item-description">
				<u-textarea v-model="historyForm.repairMethod" placeholder="请输入内容"
					@confirm="getDefineValue($event,'methods')" @blur="inputBlur($event,'methods')" confirmType='done'>
				</u-textarea>
				<record class="form-item-icon form-item-icon-voice" @setText="fnDescription($event,'methods')"></record>
				<image v-show="historyForm.repairMethod" mode="scaleToFill" class="form-item-icon form-item-icon-clear"
					src="/static/image/login/del1.png" @click="clearTxt($event, 'methods')"></image>
			</view>
		</view>
		<view class="content-colot"></view>
		<view v-show="historyForm.orderType === 'change'">
			<view class="personnel">
				<view class="personnel-tit">巡查人员</view>
				<view class="personnel-nm">{{ historyForm.inspectUser }}</view>
			</view>
			<view class="personnel">
				<view class="personnel-tit">提交时间</view>
				<view class="personnel-nm">{{ getDate2(historyForm.createDate) }}/{{ historyForm.createUserName }}
				</view>
			</view>
		</view>
		<view class="headLine">变更前病害</view>
		<view class="position-top">
			<view class="Dlocation">
				<view class="required-form-item">*</view>
				<view class="pos">病害位置</view>
			</view>
		</view>
		<view>
			<view class="begin" v-if="beforeChange.startMileage">
				<view class="start-lc">开始里程</view>
				<view class="start-bring">
					{{ beforeChange.startMileage }}
				</view>
			</view>
			<view class="begin" v-if="beforeChange.ringNumber">
				<view class="start-lc">环号</view>
				<view class="start-bring">{{ beforeChange.ringNumber }}</view>
			</view>
			<view class="begin" v-if="beforeChange.stationLocation">
				<view class="start-lc">车站位置</view>
				<view class="start-bring">{{ beforeChange.stationLocation }}</view>
			</view>
			<view class="begin" v-if="beforeChange.otherPosition">
				<view class="start-lc">其他</view>
				<view class="start-bring">{{ beforeChange.otherPosition }}</view>
			</view>
			<view class="begin1" v-if="beforeChange.clockPosition">
				<view class="start-lc">时针位置</view>
				<view class="start-bring">{{ beforeChange.clockPosition }}</view>
			</view>
		</view>
		<view class="content-colot"></view>
		<view class="position-top">
			<view class="Dlocation">
				<view class="required-form-item">*</view>
				<view class="pos">病害现状</view>
			</view>
		</view>
		<view>
			<view class="situation">{{ beforeChange.nowStatus }}</view>
			<view class="situation-le">
				<view class="leval-tit">病害等级</view>
				<view class="leval">{{ beforeChange.level }}</view>
			</view>
		</view>
		<view class="content-colot"></view>
		<!--病害滑块选择-->
		<view class="swich-selection">
			<view class="selection-choose">
				<view class="choose-text">砂性土层</view>
				<u-switch v-model="historyForm.isSandySoil" inactiveColor="rgb(230, 230, 230)" disabled></u-switch>
			</view>
			<view class="selection-choose">
				<view class="choose-text">影响设备</view>
				<u-switch v-model="historyForm.isInfluenceEquipment" inactiveColor="rgb(230, 230, 230)" disabled>
				</u-switch>
			</view>
			<view class="selection-choose" v-if="historyForm.isInfluenceEquipment">
				<view class="choose-text">影响设备位置</view>
				<view style="color: #445469">{{historyForm.deviceLocation}}</view>
			</view>
			<view class=" claa_ts">
				<view class="choose-text">铁路保护区段</view>
				<u-switch v-model="historyForm.isProtectionSection" inactiveColor="rgb(230, 230, 230)" disabled>
				</u-switch>
			</view>
		</view>

		<view class="content-colot"></view>
		<view class="ds-pto">
			<view class="ds-t">病害照片</view>
			<view class="top_co">
					<commonLookImage :imageArr="beforeChange.imgs" width="90px" height="90px"></commonLookImage>
			</view>
		</view>
		<!-- 查看变更前病害视频 -->
		<view class="content-colot"></view>
		<view class="ds-pto">
			<view class="ds-t">病害视频</view>
		</view>
		<view-video  class="no-ml" :showTitle="false"
			:videoList="beforeChange.videos" :playVideoSrc="playVideoSrc" @lookVideo="lookVideo"
			@closedVideo="closeVideo"></view-video>
		<!-- 视频结束 -->

		<view class="fix-box">
			<view class="content-colot"></view>
			<view class="disease-status">
				<view class="box-status">
					<text>修复措施</text>
				</view>
			</view>
			<view class="voice-box txt">{{beforeChange.measure}}</view>
		</view>

		<view class="content-colot"></view>
		<view class="">
			<view class="personnel">
				<view class="personnel-tit">巡查人员</view>
				<view class="personnel-nm" v-if="historyForm.orderType=== 'history_not_repaired'">
					{{ historyForm.inspectUser }}
				</view>
				<view class="personnel-nm" v-else>{{ beforeChange.inspectUser }}</view>
			</view>
			<view class="personnel">
				<view class="personnel-tit">提交时间</view>
				<view class="personnel-nm">{{ getDate2(beforeChange.createDate)}}
					{{ getDate2(beforeChange.createDate) ? `/` : `` }}{{ beforeChange.createUserName }}</view>
			</view>
			<view class="footer-button" v-if="compoType === 'change'">
				<view class="button-placeholder"></view>
				<view class="button-group">
					<button  throttleTime="2000" :loading="isChooseImg" @click="submit" :disabled="isChooseImg" class="button-primary">{{textType}}</button>
				</view>
			</view>
			<view class="footer-button" v-else>
				<view class="button-placeholder"></view>
				<view class="button-group">
					<button  @click="show1 = true"  class="button-warn">废弃</button>
					<button  @click="passBtn" :disabled="isChooseImg" :loading="isChooseImg" class="button-primary">通过</button>
				</view>
			</view>

		</view>
		<view>
			<u-modal :show="show1" :content='content' @confirm="sureBtn" @cancel="()=>show1 = false"
				:showCancelButton='true' :buttonReverse="true" confirmText='是' cancelText='否' cancelColor='red'>
			</u-modal>
		</view>
	</view>

</template>

<script>
	import mixins from "@/utils/mixins"
	import {
		getLastFillingRecord
	} from "@/api/engineeringMaintenance/maintenanceTask.js"
	import {
		uploadFile
	} from '@/utils/request'
	import {
		getToken
	} from '@/utils/auth.js'
	import {
		getPicture,
		deleteImg
	} from '@/api/doc.js' //获取图片
	import {
		diseaseGradeList,
		getDiseaseContent
	} from '@/api/engineeringMaintenance/engineeringMaintenance.js'
	import {
		doGet,
		doSave,
		doDelete
	} from "@/utils/offline/sqlite/index.js";
	//巡检的所有接口
	import * as XUNJIAN from '@/api/engineeringMaintenance/engineeringMaintenance.js'
	import {
		getImageBase64
	} from "@/utils/imageOperation.js"
	import compressionImage from "@/components/compression-image/compression-image.vue";
	import {
		imgFun
	} from "@/utils/common.js";
	import permision from "@/js_sdk/wa-permission/permission.js"
	import {
		getPermission
	} from "@/utils/common.js"
	import viewVideo from "../common/viewVideo.vue"
	export default {

		name: 'diseaseHistory',
		components: {
			compressionImage,
			viewVideo
		},
		mixins: [mixins],
		props: {
			titleName: {
				type: String,
				default: ''
			},
			compoType: {
				type: String,
				default: ''
			},
			// historyForm: {
			// 	type: Object,
			// 	default: () => ({})
			// },
			beforeChange: {
				type: Object,
				default: () => ({})
			},
			textType: {
				type: String,
				default: '提交'
			},

		},
		data() {
			return {
				testImgs: [{
					url: require('subpackage-emergency/static/img-error.png')
				}, ],
				userIsOffine: true,
				show1: false,
				content: '废弃的病害将会删除或恢复到变更前，且不可恢复，是否确认？',
				radiovalue1: '升降级',
				formData: {},
				fileListImg: [],
				radiolist: [{
						label: '升降级',
						value: 'relegation'
					},
					{
						label: '自愈',
						value: 'selfcure'
					},
				],
				radiolist1: [{
						name: '升级',
						disabled: false
					},
					{
						name: '降级',
						disabled: false
					},
					{
						name: '自愈',
						disabled: false
					},
				],
				radiovalue: '升级',
				isChooseImg: false,
				equipList: [],
				isClickEnter: false, //是否自定义现状
				levelColumns: [
					[],
					[]
				],
				values: [0, 0],
				isCanEdit: true,

				playVideoSrc: '',
				historyForm: {},
			}
		},
		watch: {
			"historyForm.fileListImg": {
				handler(newVal, oldVal) {
					if (newVal) {
						this.fileListImg = newVal
					}
				},
				immediate: true,
				deep: true
			},
			"historyForm.videoFileList": {
				handler(newVal, oldVal) {
					if (newVal) {
						this.historyForm.videoFileList = newVal
					}
				},
				immediate: true,
				deep: true
			}
		},
		mounted() {
			this.equipList = this.$store.getters.dictMap['device_location']
		},
		methods: {
			// 删除文件
			closeFile(file, index) {
				console.log(file, index);
				if(file.uploadStatus) {
					return uni.showToast({
						title:'上传中,请稍后再试！',
						icon:'none',
						mask:true
					})
				}
				if (!this.historyForm.removeFileSet) {
					this.historyForm.removeFileSet = new Set()
				}
				if (file.id) {
					this.historyForm.removeFileSet.add(file.id)
				}
				this.historyForm.videoFileList.splice(index, 1)
				// doDelete(deleteImg, {
				// 	id: file.id
				// }).then(res => {
				// 	console.log(res, 'shan')
				// 	if (!res.success) return uni.showToast({
				// 		title: '删除失败',
				// 		icon: "none"
				// 	})
				// 	let arr = this.historyForm.videoFileList.splice(index, 1)
				// 	console.log(arr, 'arr');
				// 	uni.showToast({
				// 		title: '删除成功',
				// 		icon: "none"
				// 	})
				// })
			},
			/** 预览文件 */
			handleClickPreview(item) {
				console.log(item, '查看视频---disHistory组件');
				this.playVideoSrc = item.url;
			},
			lookVideo(url) {
				this.playVideoSrc = url;
				console.error(this.playVideoSrc, 'ppp');
			},
			closeVideo() {
				this.playVideoSrc = ''
			},
			async clickMedias(e) {
				// #ifdef APP-PLUS
				// this.requestAndroidPermission("android.permission.CAMERA")
				let testPer = await getPermission("android.permission.CAMERA")
				console.log(testPer, 'testPer');
				// #endif
				uni.chooseVideo({
					sourceType: ['camera', 'album'],
					success: async res => {
						console.log(res, '选择成功回调函数');
						if (parseInt(res.duration) > 60) {
							return uni.showToast({
								title: '上传的视频不能超过60s',
								icon: 'none',
								mask: true
							})
						}
						this.historyForm.videoFileList.push({
							url: res.tempFilePath,
							type: "video",
							uploadStatus:true
						})
						let fileList = [...this.historyForm.videoFileList].filter(item => !item.id);
						for (let item of fileList) {
							let formData = {}
							if (this.historyForm.videoDocId) {
								formData.docId = this.historyForm.videoDocId
							}
							// #ifdef APP-PLUS || H5
								const uploadVideo = {
									url: "rest/doc/uploadDoc",
									formData,
									files: [{
										name: "attach",
										uri: item.url
									}],
									isOffline: true
								}
							// #endif

							// #ifdef MP-WEIXIN
								const uploadVideo = {
									url: "rest/doc/uploadDoc",
									formData,
									name: "attach",
									filePath:item.url,
									isOffline: true
								}
							// #endif
							let data = await doSave(uploadFile, uploadVideo)
							let res = data
							console.log(res, 'DISHISTORY组件');
							if (!res.success) return
							this.historyForm.videoDocId = res.result.id
							console.log(this.historyForm.videoDocId, '返回的id');
							const attachRes = await doGet(getPicture, {
								docId: this.historyForm.videoDocId
							})
							console.log(attachRes, 'attachRes');
							if (attachRes.success && attachRes.result) {
								// attachRes.result = attachRes.result.filter(item => item.contentType.substring(
								// 	0, item.contentType.indexOf("/")) === 'video')
								// console.log(type,'过滤出类型为视频的数据');
								attachRes.result = attachRes.result.map(it => ({
									id: it.id,
									url: it.fileName ?
										this.$config.VIDEO_URL + it.fileName : it.url,
									uploadStatus:false
								}))
								this.$set(this.historyForm, 'videoFileList', attachRes.result)
								this.historyForm.updateVideoIds = this.historyForm.videoFileList.map(i => i.id) || []
								this.historyForm.videoFileList = this.historyForm.videoFileList.filter(it => ![...this.historyForm.removeFileSet].includes(it.id))
							}
						}
					},
					fail: (e) => {
						console.warn('错误', e);
					},
					complete: (end) => {
						// console.log(end);
					}
				});
			},

			// 删除图片
			deletePic(event) {
				doDelete(deleteImg, {
					id: event.file.id
				}).then(res => {
					// console.log(res, 'shan')
					if (!res.success) return uni.showToast({
						title: '删除失败',
						icon: "none"
					})
					this.historyForm.fileListImg.splice(event.index, 1)
					// uni.showToast({
					// 	title: res.message,
					// 	icon: "none"
					// })
				})
			},
			// 新增图片
			async afterRead(event) {
				this.isChooseImg = true
				let tempImgList = []
				for (var item in event.file) {
					event.file[item].url = await imgFun(event.file[item])
					event.file[item].thumb = await imgFun(event.file[item])
					this[`fileList${event.name}`].push({
						...event.file[item],
						status: 'uploading',
						message: '上传中'
					})
				}
				//1、通过上传接口获取水印图片的id
				// let fileList = [...tempImgList]
				let fileList = [...this.fileListImg]
				for (let item of fileList) {
					if (!item.status) continue
					let formData = {}
					//拼接水印数据
					// console.log(this.formData.docId,'数据id')
					//区间/站点
					formData.name = this.historyForm.lineSiteSectionName
					//里程
					const distance = this.getContent2(this.historyForm)
					//环号
					const startRing = this.historyForm.startNumber || ''
					const endRing = this.historyForm.endNumber || ''
					const others = this.historyForm.others || ''
					const timeClock = this.historyForm.clockwisePosition || ''
					formData.ring =
						`${distance}${distance && startRing ? ',' : ''}${startRing}${startRing && endRing ? '~' : '' }${endRing}${(distance && others)||(endRing && others) ? ',' : ''}${others}${(distance && timeClock)  ||  (startRing && endRing && timeClock) || (others&&timeClock)  ? ',' : ''}${timeClock}`
					//现状
					formData.status = this.historyForm.diseaseStatus || ''
					formData.dateTime = this.getDate2(new Date)
					let arrList = [formData.name, formData.ring, formData.status, formData.dateTime]
					let isOwnerProjectId = uni.getStorageSync("isOwner")
					let resq_params = {
						token: getToken(),
						dataList: JSON.stringify(arrList),
						projectId: isOwnerProjectId

					}
					//通过index判断 避免图片id一直是同一个
					if (this.historyForm.docId) {
						// console.log('进判断吗')
						resq_params.docId = this.historyForm.docId
					}
					//请求水印接口
					// #ifdef APP-PLUS || H5
					const uploadImg = {
						url: "composite/picture/addPictureText",
						formData: resq_params,
						files: [{
							name: "file",
							uri: item.url
						}],
						isOffline: true
					}
					// #endif

					// #ifdef MP-WEIXIN
					const uploadImg = {
						url: "composite/picture/addPictureText",
						formData: resq_params,
						name: `file`,
						filePath: item.url,
						isOffline: true
					}
					// #endif
					let data = await doSave(uploadFile, uploadImg)
					let res = data
					if (!res.success) {
						uni.showToast({
							title: '请求水印图片失败',
							icon: 'none'
						})
						this.isChooseImg = false
						return
					} else {
						this.historyForm.docId = res.result.id
						const attachRes = await doGet(getPicture, {
							docId: this.historyForm.docId
						})
						if (attachRes.success && attachRes.result) {
							attachRes.result = attachRes.result.map(it => ({
								id: it.id,
								url: it.fileName ?
									this.$config.IMG_FILE_URL + it.fileName :
									it.url
							}))
							this.$set(this.historyForm, 'fileListImg', attachRes.result)
							this.historyForm.updateIds = this.historyForm.fileListImg.map(i => i.id) || []
						}
						this.isChooseImg = false
					}

				}

			},
			/**
			 * @param {String} type
			 * 通过类型判断是现状还是修复措施
			 */
			getChooseType(type) {
				if (type === 'status') {
					this.isCanEdit = false
					this.isClickEnter = true
					this.historyForm.diseaseGrade = undefined
					this.historyForm.diseaseNo = undefined
					this.historyForm.diseaseStandardLibraryId = undefined
				} else {
					this.historyForm.diseaseMaterialId = undefined
				}
			},
			inputBlur(e, type) {
				this.cursor = e.detail.cursor
				this.getChooseType(type)
			},
			fnDescription(text, type) {
				let index = this.cursor || 0
				let str = this.formData.description || ""
				this.cursor += text.length
				text = str.slice(0, index) + text + str.slice(index);
				if (type === 'status') {
					this.$set(this.historyForm, "diseaseStatus", text)
				} else {
					this.$set(this.historyForm, "repairMethod", text)
				}
				// this.$set(this.formData, "description", text)
			},
			groupChange(e) {
				// console.log(e, '这是啥');

				if (e === 'selfcure') {
					this.historyForm.diseaseStatus = '自愈'
					this.historyForm.diseaseGrade = 'E'
					this.historyForm.diseaseGradeName = 'E'
					this.historyForm.diseaseStandardLibraryId = 0
					// this.historyForm.diseaseGradeId = null
				} else {
					this.historyForm.diseaseStatus = ''
					this.historyForm.diseaseGrade = ''
					this.historyForm.diseaseStandardLibraryId = ''
					this.historyForm.diseaseNo = ''
				}
			},
			diseaseJs() {
				console.log(this.historyForm,'===');
				this.isCanEdit = true
				uni.navigateTo({
					url: `/subpackage-enginner/pages/engineeringMaintenance/on_site_inspection/components/dPresent?lineSiteSectionType=${this.historyForm.lineSiteSectionType}`,
					events: {
						setData: (data) => {
							this.$set(this.historyForm, 'diseaseStatus', data.data.diseaseStatus)
							this.$set(this.historyForm, 'diseaseGrade', data.data.diseaseGrade)
							this.$set(this.historyForm, 'diseaseGradeName', data.data.diseaseGrade)
							this.$set(this.historyForm, 'diseaseGradeId', data.data.diseaseGradeId)
							this.$set(this.historyForm, 'diseaseStandardLibraryId', data.data.id)
							this.$set(this.historyForm, 'diseaseNo', data.data.diseaseNo)
							this.$set(this.historyForm, 'rankClass', data.data.diseaseCode)
						}
					},
				})
			},
			validRequire() {
				if (!this.historyForm.diseaseStatus) {
					uni.showToast({
						title: '请填写病害现状',
						icon: "none"
					})
					return false
				}
				if (!this.historyForm.diseaseGrade) {
					uni.showToast({
						title: '请填写病害等级',
						icon: "none"
					})
					return false
				}
				return true
			},
			submit() {
				if (!this.validRequire()) return
				// console.log(this.historyForm, '传给父组件')
				this.$emit('updateSubmit', this.historyForm)
			},
			passBtn() {
				if (!this.validRequire()) return
				this.$emit('passSubmit', this.historyForm, true)
			},
			sureBtn() {
				if (!this.validRequire()) return
				this.$emit('passSubmit', this.historyForm, false)
			},
			//现状回车按钮事件
			getDefineValue(val, type) {
				// console.log(val)
				this.getChooseType(type)
			},
			//录音框清除事件
			clearTxt(val, type) {
				if (type === 'status') {
					this.isClickEnter = false
					this.historyForm.diseaseStatus = ''
					this.historyForm.diseaseGrade = undefined
					this.historyForm.diseaseNo = undefined
					this.historyForm.diseaseStandardLibraryId = undefined
				} else {
					this.historyForm.repairMethod = ''
					this.historyForm.diseaseMaterialId = undefined
				}
			},
			//选择病害等级
			fnChooseLevel() {
				this.getLevelOptions(uni.getStorageSync('isOwner'))
			},
			//获取病害等级选择项
			async getLevelOptions(projectId) {
				let resq = {
					currPage: 1,
					pageSize: 9999,
					params: {
						projectId
					}
				}
				let result1 = await doGet(XUNJIAN.diseaseGradeList, resq)
				let {
					list
				} = result1.result || []
				this.levelColumns[0] = list
				if (list.length > 0) {
					let result2 = await doGet(XUNJIAN.getDiseaseContent, {
						diseaseGradeId: this.selectedFirstId ? this.selectedFirstId : list[0].id,
						code: JSON.parse(uni.getStorageSync('lineData')).lineSiteSectionType
					})
					this.levelColumns[1] = result2.result.map(it => ({
						...it,
						diseaseGrade: it.diseaseNo,
						diseaseNo: it.diseaseGrade
					}))
				}
				this.$forceUpdate()
			},
			fnMultiColumnChange(e) {
				if (!e.detail.column) {
					let idx = e.detail.value
					this.values = [e.detail.value, 0] // 区列表下标归零
					// console.log(this.values, 'values')
					// getDiseaseContent({
					// 	diseaseGradeId: this.levelColumns[0][idx].id,
					// 	code: JSON.parse(uni.getStorageSync('lineData')).lineSiteSectionType
					// })
					doGet(XUNJIAN.getDiseaseContent, {
							diseaseGradeId: this.levelColumns[0][idx].id,
							code: JSON.parse(uni.getStorageSync('lineData')).lineSiteSectionType
						})
						.then(res => {
							this.levelColumns[1] = res.result.map(it => ({
								...it,
								diseaseGrade: it.diseaseNo,
								diseaseNo: it.diseaseGrade
							})) // 设置多级联动区列表的值
							this.$forceUpdate()
						})
				}
			},
			//工作面确定后事件
			fnMultiPickerChange(e) {
				// console.log(e.detail, 'eeeee')
				let _taskIdx = e.detail.value[0]
				//通过这个id查询第二列数据
				this.selectedFirstId = this.levelColumns[0][_taskIdx].id
				let _faceIdx = e.detail.value[1]
				let selectData = [this.levelColumns[0][_taskIdx], this.levelColumns[1][_faceIdx]]
				// console.log(this.historyForm.diseaseStandardLibraryId, '----')
				if (this.levelColumns[1][_faceIdx]) {
					this.$set(this.historyForm, 'diseaseGrade', this.levelColumns[1][_faceIdx].diseaseNo)
					this.$set(this.historyForm, 'diseaseNo', this.levelColumns[1][_faceIdx].diseaseGrade)
					this.$set(this.historyForm, 'diseaseStandardLibraryId', this.levelColumns[1][_faceIdx].id)
					this.$set(this.historyForm, 'diseaseGradeId', this.levelColumns[0][_taskIdx].id)
					this.$set(this.historyForm, 'diseaseGradeName', this.levelColumns[0][_taskIdx].diseaseGrade)
					this.$set(this.historyForm, 'rankClass', this.levelColumns[0][_taskIdx].code)
				} else {
					this.$set(this.historyForm, 'diseaseGrade', this.levelColumns[0][_taskIdx].diseaseGrade)
					// this.$set(this.historyForm, 'diseaseStatus', this.levelColumns[0][_taskIdx].diseaseGrade)
					this.$set(this.historyForm, 'diseaseNo', '')
					this.$set(this.historyForm, 'diseaseGradeId', this.levelColumns[0][_taskIdx].id)
					this.$set(this.historyForm, 'diseaseGradeName', this.levelColumns[0][_taskIdx].diseaseGrade)
					this.$set(this.historyForm, 'diseaseStandardLibraryId', 0)
				}
				this.$forceUpdate()
				this.isClickEnter = false
			},
			//取消事件
			fnlevelCancel() {},
			chooseRepair() {
				uni.navigateTo({
					url: "/subpackage-enginner/pages/engineeringMaintenance/common/table",
					events: {
						setData: (data) => {
							// console.log(data.data, '打印');
							this.$set(this.historyForm, 'diseaseMaterialId', data.data.id)
							this.$set(this.historyForm, 'repairMethod', data.data.makt)
						}
					}
				})

			}
		}
	}
</script>

<style lang="scss" scoped>
	.claa_ts {
		display: flex;
		height: 66px;
		justify-content: space-between;
		align-content: center;
		flex-wrap: wrap;

		.choose-text {
			font-size: 32rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #586981;
		}
	}

	.dis-history {
		/* #ifdef MP-WEIXIN */
			padding-top: 190rpx;
		/* #endif */
		.btn {
			height: 150rpx;
			width: 688rpx;
			margin-left: 30rpx;
		}

		.personnel {
			width: 90%;
			margin-left: 40rpx;
			display: flex;
			height: 100rpx;
			justify-content: space-between;

			.personnel-tit {
				font-size: 32rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #445469;
				line-height: 100rpx;
			}

			.personnel-nm {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #445469;
				line-height: 100rpx;
			}
		}

		.ds-pto {
			.ds-t {
				width: 90%;
				height: 100rpx;
				font-size: 32rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				line-height: 100rpx;
				margin-left: 40rpx;
			}

			.top_img {
				display: flex;
				// margin-left: 40rpx;
				padding-bottom: 40rpx;
				&>view {
					width: 200rpx;
					margin-right: auto;

				}
			}
		}

		.dlocation-text {
			width: 85%;
			word-break: break-all;
			margin-left: 80rpx;
			padding-top: 40rpx;
			padding-bottom: 40rpx;
			font-size: 32rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #586981;
		}

		.situation {
			font-size: 32rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #586981;
			width: 85%;
			margin-left: 80rpx;
			padding-top: 40rpx;
			padding-bottom: 40rpx;
			border-bottom: 2rpx solid #d9d4d4;
		}

		.swich-selection {
			width: 85%;
			margin-left: 80rpx;

			.selection-choose {
				display: flex;
				height: 120rpx;
				justify-content: space-between;
				border-bottom: 2rpx solid #e5e5e5;
				align-content: center;
				flex-wrap: wrap;

				.choose-text {
					font-size: 32rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #586981;
				}
			}
		}

		.situation-le {
			display: flex;
			justify-content: space-between;
			margin-left: 80rpx;
			height: 120rpx;
			width: 84%;
			// border-bottom: 2rpx solid #d9d4d4;

			.leval-tit {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #586981;
				line-height: 120rpx;
			}

			.leval {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #4F5E72;
				line-height: 120rpx;
			}
		}

		.headLine {
			width: 100%;
			height: 112rpx;
			background: #F5F7FA;
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #445469;
			line-height: 124rpx;
			padding-left: 40rpx;
		}

		.Dlocation {
			display: flex;
			// justify-content: space-between;
			// align-items: center;
			width: 92%;
			height: 100rpx;
			font-size: 32rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			line-height: 100rpx;
			margin-left: 40rpx;
			border-bottom: 2rpx solid #e5e5e5;

			.required-form-item {
				color: red;
				line-height: 112rpx;
			}
		}

		.position-top {
			display: flex;

			.pos {
				// margin-right: 100rpx;
				margin-right: 80rpx;
			}

			.rg {
				height: 100rpx;
			}


		}

		.rg1 {
			height: 100rpx;
			padding-left: 80rpx;
		}

		.content-colot {
			height: 40rpx;
			background: #F5F7FA;
		}

		.begin1 {
			display: flex;
			justify-content: space-between;
			height: 120rpx;
			margin-left: 80rpx;
			width: 84%;

			.start-lc {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #586981;
				line-height: 120rpx;
			}


			.start-bring {
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #445469;
				line-height: 120rpx;
				max-width: 380rpx;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
			}
		}

		.begin {
			display: flex;
			justify-content: space-between;
			height: 120rpx;
			margin-left: 80rpx;
			width: 84%;
			border-bottom: 2rpx solid #e5e5e5;

			.start-lc {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #586981;
				line-height: 120rpx;
			}


			.start-bring {
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #445469;
				line-height: 120rpx;
				max-width: 380rpx;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
			}
		}

		.disease-status {
			display: flex;
			width: 90%;
			height: 100rpx;
			font-size: 32rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			line-height: 100rpx;
			margin-left: 40rpx;
			border-bottom: 2rpx solid #e5e5e5;

			.required-form-item {
				color: red;
				line-height: 112rpx;
			}

			.icon-disease {
				margin-top: 34rpx;
				margin-left: 474rpx;
			}
		}

		.explanation {
			width: 84%;
			margin-left: 80rpx;
			font-size: 32rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #586981;
			padding-top: 3%;
		}

		.l-dsGrade {
			// width: 84%;
			height: 120rpx;
			display: flex;
			margin-left: 40rpx;
			justify-content: space-between;
			align-items: center;
			// border-top: 2rpx solid #e5e5e5;
			// margin-top: 20rpx;

			.l-dsGrade-text {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #586981;
				line-height: 120rpx;
			}

			.l-dsGrade-text:before {
				content: '*';
				color: red;
			}

			.l-leave {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #4F5E72;
				line-height: 120rpx;
			}
		}

		.d-remarks {
			width: 90%;
			margin-left: 40rpx;

			.d-text {
				display: flex;
				align-items: center;
				justify-content: space-between;
				height: 100rpx;
				font-size: 32rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #445469;
				line-height: 100rpx;
			}
		}

		.form-item {
			width: 100%;
			position: relative;
			margin-bottom: 40rpx;
		}

		.form-item-description {
			.form-item-icon {
				width: 48rpx;
				height: 48rpx;
			}

			.form-item-icon-voice {
				position: absolute;
				top: 10rpx;
				right: 16rpx;
				z-index: 3;
			}

			.form-item-icon-clear {
				position: absolute;
				right: 16rpx;
				bottom: 10rpx;
				z-index: 2;
			}
		}

		.photo-list {
			width: 90%;
			margin-left: 40rpx;

			.photo-top {

				display: flex;
				height: 100rpx;
				justify-content: space-between;

				.photo-text {
					font-size: 32rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #445469;
					line-height: 100rpx;
				}
			}
		}

		.btn_box {
			height: 100rpx;

			.btn_group {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 100rpx;
				position: fixed;
				bottom: 0;
				width: 100%;
				z-index: 10;
			}
		}

	}

	.top_co {
		width: 90%;
		position: relative;
		left: 5%;
		overflow-x: auto;
	}

	/deep/ .u-radio-group {
		height: 100rpx;
	}

	/deep/ .uni-textarea-wrapper {
		width: 94%;
	}

	.box-status {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
	}

	.voice-box {
		margin: 0 40rpx;
		display: flex;
		align-items: center;
		color: #445469
	}

	.voice-box.txt {
		padding: 20rpx 0;
	}

	.video-class /deep/ .u-upload__wrap {
		flex-direction: column;
	}

	/deep/ .photo-list.no-ml {
		margin-left: 0;
	}
</style>